package com.briup.estore.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.briup.estore.common.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.briup.estore.common.utils.PageUtils;
import com.briup.estore.dao.ShopDao;
import com.briup.estore.entity.ShopEntity;
import com.briup.estore.service.ShopService;


@Service("shopService")
public class ShopServiceImpl extends ServiceImpl<ShopDao, ShopEntity> implements ShopService {

    @Autowired
    private  ShopDao shopDao;

    //查询在售商品  根据是否为特价商品进行查询
    public List<ShopEntity> findStatusAndDisCount(boolean discount) {
        List<ShopEntity> list = shopDao.selectList(new QueryWrapper<ShopEntity>().eq("stat", true).eq("discount", discount));
        return list;
    }

    @Override
    public List<ShopEntity> findContainsName(String name) {
        List<ShopEntity> list = shopDao.selectList(new QueryWrapper<ShopEntity>().like("name",name));
        return list;
    }

    @Override
    public List<ShopEntity> findByCategoryId(Long categoryId) {
        List<ShopEntity> list = shopDao.selectList(new QueryWrapper<ShopEntity>().eq("category_id", categoryId));
        return list;
    }
}